package com.cskaoyan.bean.bo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

//@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsProductBO {
    private Integer id;
    private Integer goodsId;
    private List<String> specifications;
    private BigDecimal price;
    private Integer number;
    private String url;
    private Date addTime;
    private Date updateTime;
    private Boolean deleted;
    private String specificationString;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }


    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public String getSpecificationString() {
        return specificationString;
    }

    public void setSpecificationString(String specificationString) {
        this.specificationString = specificationString;
    }

    public List<String> getSpecifications() {
        return specifications;
    }

    public void setSpecifications(List<String> specifications) {
        this.specifications = specifications;
        StringBuffer sb = new StringBuffer();
        sb.append("[");
        if (specifications!=null&&specifications.size()!=0){
            for (String specification : specifications) {
                sb.append("\"");
                sb.append(specification);
                sb.append("\",");

            }
            sb.deleteCharAt(sb.length()-1);
        }
        this.specificationString = sb.append("]").toString();
//        this.specificationString = Arrays.toString(specifications.toArray());
    }

}
